Repository navigation
Conversation
This was referenced Nov 24, 2026
Register Intel XPU in ROLL's platform abstraction: device detection, the XCCL communication backend, XPU device visibility for Ray workers, and the XPU vLLM worker. Add a supports_tensor_ipc platform flag (default True) so colocated weight updates use the existing broadcast path when tensor IPC is unavailable, and call the CUDA allocator and host-cache APIs only when the PyTorch build provides them. Document the supports_tensor_ipc flag and the Ray visible-device fallback with one-line comments.
Keep all node-local XPUs visible to every Ray worker instead of narrowing each worker with ZE_AFFINITY_MASK, which gives oneCCL inconsistent device lists across processes. Record the Ray-assigned XPUs in ROLL_ASSIGNED_XPU_IDS, align LOCAL_RANK with the assigned XPU, select it with torch.xpu.set_device() at worker start, and pass the assigned device IDs to vLLM. The new platform hooks are no-ops on other platforms. With vLLM data parallel, vLLM's XPU worker selects its device from a node-local slot derived from the DP rank and indexes device_ids by that slot, so for data_parallel_size > 1 order device_ids so that the slot holds the XPUs ROLL assigned to the rank. Document the new platform hooks with docstrings and the XPU placement choices with one-line comments.
Madhustat
force-pushed
the
xpu/pr1-explicit-device-placement
branch
from
November 27, 2026 06:03
6d1af9b to
e0f1a78
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title: fix(xpu): add explicit device placement for Ray workers and vLLM
Relates to #525
This PR is stacked on #526 and adds explicit XPU placement for ROLL workers and vLLM. Until #526 is merged, the GitHub diff also includes its base platform commit; the explicit-device-placement change is the final commit in this PR.
Summary
Explicitly place each ROLL worker on its assigned node-local XPU:
LOCAL_RANKwith the assigned XPUThe implementation is isolated through two platform hooks that are no-ops by default, so CUDA, ROCm, NPU, and CPU behavior is unchanged.
Motivation
ROLL isolates each worker with the platform's device-visibility variable, which for XPU is
ZE_AFFINITY_MASK. With per-worker masks, each process sees a different device list than its peers, and oneCCL reports anarrow device affinity mask. In our testing, an agentic FrozenLake run with per-worker masks hung at its first trainer-to-vLLM weight broadcast.With this change, every worker sees the same node-local XPUs and selects its assigned one with
torch.xpu.set_device(), and the same workflow passes.Changes
roll/platforms/platform.py: add two hooks with no-op defaults,select_assigned_devices()andget_vllm_device_kwargs(engine_kwargs).roll/platforms/xpu.py(added by feat(xpu): add Intel XPU platform support #526):update_env_vars_for_visible_devices()to record the assigned XPUs inROLL_ASSIGNED_XPU_IDSand setLOCAL_RANK, instead of settingZE_AFFINITY_MASK, and overrideget_visible_gpus()to read them back.select_assigned_devices()selects the first assigned XPU withtorch.xpu.set_device()and logs the placement.get_vllm_device_kwargs()returns the assigned XPUs asdevice_idsfor vLLM. This path is validated with vLLM 0.31.0+xpu, which supportsdevice_idson XPU; for earlier versions ROLL raises an error instead of continuing without explicit placement. Withdata_parallel_size > 1, vLLM's XPU worker selects its device from a slot indevice_idsderived from the data-parallel rank, so the assigned XPUs are placed in that slot.roll/distributed/executor/worker.py: callselect_assigned_devices()at the start ofWorker.__init__.roll/third_party/vllm/__init__.py: pass the engine arguments toget_vllm_device_kwargs()and its result to thevLLM engine.
LOCAL_RANKis aligned with the assigned XPU because TRL's value-head model, used for the critic, selects its device throughaccelerate.PartialState, which readsLOCAL_RANK.If
ZE_AFFINITY_MASKis also set, workers raise an error, because ROLL cannot verify that all ranks see the same devices.Validation
Hardware and software: 2 × Intel Arc Pro B70, PyTorch 2.14.0+xpu, vLLM 0.31.0+xpu, Ray 2.48.0, oneCCL 2022.0.0.
This PR with #526. Representative configurations derived from ROLL examples, reduced to two XPUs, small models, and shorter sequence lengths, with FSDP2 training, plus the repository's log-probability tests:
tests/distributed/strategy/log_probs/)Also verified:
[0, 1]and[1, 0], each worker runs on its assigned XPU, and the workers use distinct physical XPUs.select_assigned_devices()return the expected tensors.narrow device affinity maskwarning appeared in the validated runs.NVIDIA, no regression. Counterpart workflows were run on 2 NVIDIA GPUs on
mainand on a combined branch thatincludes this PR, with matching results. The platform unit tests on CPU also match
main.Scope
This PR covers explicit XPU placement for Ray workers and vLLM on a single node with multiple XPUs. These items are tracked separately:
vLLM data parallel was validated with an MoE model, because vLLM 0.31.0+xpu accepts external data parallel only for MoE models.
This PR does not change device placement on other platforms, ROLL algorithms, or model computation.